The invention relates to a microcontroller for controlling various types of sequences.
Microprocessors have been widely used in controlling various types of sequences in a digital servo system in optical disc system for example. A well known tool to represent such sequence is a timing chart, which is not very comprehensive, however, particularly when the sequence involves many objects to process. An intuitive yet more comprehensive tool is a state transition diagram which allows one to directly grasp the relationships among the objects. Indeed, a sequence is often controlled by a microprocessor based on a programmed state transitions appearing in the diagram.
Such sequence is normally processed at a regular time interval called sampling period or processing period. To do this, a timer or software is needed to make interruptions based on the calculation of the period.
FIG. 1 is a block diagram representation of a conventional sequence control system for controlling a sequence using a microprocessor. FIG. 2 illustrates a multi-channel state transition diagram consisting of state transition diagrams for the channels.
In the conventional microcontroller as shown in FIG. 1, interruption controller 63 is enabled by a sampling pulse generated by timer 64 at a fixed time interval or processing period Ts. Program memory 62 stores a program for controlling the sequences associated with the state transition diagrams for processing channels CH0-CHn as shown in FIG. 2. Each processing channel may have a multiplicity of states (for example State 0-State 2 in the case of channel CH0) and a multiplicity of state transitions associated with the states (for example state transitions (a)-(g) in processing channel CH0). Input/ Output (I/O) port 65 is provided to receive necessary information from an external source and provides control signals to external devices.
Microprocessor (MPU) 61 is enabled by a signal from interruption controller 63 to execute an interruption program to control the sequence for that processing period associated with the signal. At this point of time, the MPU obtains information from an external source and from the program stored in program memory 62 to determine the objects to process in the processing period, and then starts processing of the objects sequentially in each channel. All the channels (i.e. objects in the channels) will be processed in a given period Ts.
Such a conventional sequence control system as mentioned above requires enablement of an interruption program, execution thereof, determination of the current states as well as objects to be processed therefor, for each sampling period. Thus, as the sequence in each channel becomes complex and/or multiple channel processing is needed, the total number of steps in one sampling period Ts becomes enormous.
Consequently, it is becoming increasingly difficult for conventional general purpose microprocessors to finish all or the required processes within a limited sampling period Ts. Thus, if a conventional sequence control system were used, use of an advanced faster processor having a faster operational speed (or higher clock frequency) or an additional external hardware would be inevitable.
The invention is directed to an improved microcontroller having a simple hardware mean, capable of reducing a number of processing steps of a program, thereby enabling processing of a complex multi-channel sequences without using advance processors or external hardware. The microcontroller of the invention has a feature that it can be used with a conventional general purpose microprocessor.
In one aspect, the invention provides a programmable microcontroller for controlling multi-channel sequences of states to be processed in each processing period based on prescribed state transitions, comprising;
state registers for holding the state data to be processed in the next processing period, wherein
said microcontroller is adapted to execute, upon receipt of a channel processing request, a program for processing the states in the channels addressed by said channel processing request in accordance with the state data held in said state registers for said channels.
In this arrangement, the microcontroller require no fast microprocessor in handling a multi-channel program since it has state registers as described above for registering the state data for each of the channels to be processed in one processing period. Thus, the microcontroller has an architecture which is suitable to represent sophisticated state transition diagrams and to establish efficient sequences for the program.
In another aspect, the invention provides a programmable microcontroller for controlling multi-channel sequences of states to be processed in each processing period based on prescribed state transitions, comprising:
state registers, one for each of said channels, for holding the state data to be processed in the respective channels in the next processing period, wherein
said microcontroller is adapted to execute, upon receipt of a channel processing request for processing the states in each of the channels designated by said request, a program for processing said states within said processing period in accordance with the state data currently held in the respective state registers.
In this arrangement, the microcontroller has state registers for registering the state data for each of the channels to be processed, which is suitable in representing state transition diagrams and establishing efficient processing sequences for the program. In addition, since the processing of the channels may be sequentially carried out in a given processing period based on the state data held in the respective state registers, sequential processings of the channels can be performed independently. Thus, if a multiplicity of state transitions distributed over different channels must be processed by a single processor, they can be described in a program as independent pieces that can be processed in the respective channels, thereby allowing for simple programming and simple debugging.
In a further aspect, the invention provides a programmable microcontroller for controlling multi-channel sequences of states to be processed in each processing period based on prescribed state transitions, comprising:
state registers, one for each of said channels, for holding the state data to be processed in the respective channels in the next processing period, wherein said microcontroller is adapted to:
receives a sampling dock defining said processing period without being interrupted by a timer or a program;
receive, upon receipt of said sampling clock, a channel processing request for processing the states in the channel designated by said request in the current processing period; and
execute a program for processing said states in accordance with the states data held in said state register.
In this arrangement, the microcontroller has a hardware feature that it is enabled directly by a sampling clock signal to start the program for processing the states based on the state data held in the state register for each of the channels. In addition, the microprocessor has a suitable architecture to represent a state transition diagrams for such program. Thus, it is possible to configure efficient sequences for a program without resorting to a fast microprocessor. It is noted that, in this example, the sequence of the program split into independent pieces to be processed in sequence in the respective channels within a given processing period. Hence, even in a case where such multi-channel state transitions must be carried out by a single processor, the program can be written as a simple collection of steps to be performed in the respective states. This implies that debugging of the program is easy.
In a still further aspect, the invention provides a microcontroller for controlling multi-channel sequences of states in which a determination is made, at the point when the current program for one channel is finished, to decide on the program that must be performed in the next processing period and overwrites state register for that channel.
It should be noted that, in this arrangement, the state data in the state register associated with each channel is overwritten at the end of the program for the channel, based on the current states and external information available, so that updating of the state registers can be done quite easily.